package com.cpecc.dao.system;

import javax.annotation.Resource;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.cpecc.model.system.ShiYongZT;

@Repository
public class ShiYongZTDao {

	@Resource
	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	public void save(ShiYongZT shiYongZT){
		Session session=sessionFactory.getCurrentSession();
		session.save(shiYongZT);
		session.flush();
	}
	
	public ShiYongZT get(int id){
		return (ShiYongZT) sessionFactory.getCurrentSession().get(ShiYongZT.class, id);
	}
}
